package main

import (
	"fmt"
	"reflect"
)

func main() {
	// 对基本数据类型进行反射
	var num int = 100
	testReflect(num)
}

func testReflect(i interface{}) {
	// teypOf
	reType := reflect.TypeOf(i)
	fmt.Println("reType: ", reType)
	fmt.Printf("reType类型: %T \n", reType)


	reValue := reflect.ValueOf(i)
	fmt.Println("reValue: ", reValue.Int())
	fmt.Printf("reValue类型: %T \n", reValue)


	//将reValue转成空接口，进行类型断言
	i2 := reValue.Interface()
	n := i2.(int)
	n2 := n + 30
	fmt.Println(n2)

}